/*
 * Copyright (c) 2019 Nanjing Wind Information Co., Ltd. All Rights Reserved;
 * @Package wind.autotest.database.operate
 * @version 1.0.0
 * @Date 2019年5月5日
 * @author jlliu.Farrior@wind.com.cn
 */
package wind.autotest.database.operate;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import wind.autotest.database.suport.DbConnetManager;

/**
 * @Description: <类功能描述>
 * @author jlliu.Farrior@wind.com.cn
 * @Date 2019年5月5日 下午8:38:23
 * 
 */
@Service
public class CommonDao {
	@Autowired
	private DbConnetManager dbConnetManager;
	
	
	public Map<String,Object> query(String tableName,String objectId, String params) {
		JdbcTemplate jdbcTemplate = new JdbcTemplate(dbConnetManager.getDataSource());
		StringBuilder sqlBuilder = new StringBuilder(String.format("select %s from", params));
		sqlBuilder.append(tableName).append(" where OB_OBJECT_ID ='");
		sqlBuilder.append(objectId).append("'");
		return jdbcTemplate.queryForMap(sqlBuilder.toString());
	}
}
